package com.javasm.adminapi.module.priceadjust.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.javasm.adminapi.module.priceadjust.dto.SearchDTO;
import com.javasm.adminapi.module.priceadjust.entity.GgPriceAdjust;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 商品管理-价格调整(GgPriceAdjust)表数据库访问层
 *
 * @author makejava
 * @since 2025-10-16 20:52:04
 */
public interface GgPriceAdjustDao extends BaseMapper<GgPriceAdjust> {


    @Select("<script>" +
            "SELECT pa.*, gg.gname, gg.shop_price as old_shop_price,gg.market_price as old_market_price,gg.stock as stock " +
            "FROM gg_price_adjust pa, gg_goods gg " +
            "WHERE pa.goods_id = gg.id " +
            "<if test=\"gname != null and gname != ''\">" +
            " AND gg.gname LIKE CONCAT('%', #{gname}, '%')" +
            "</if>" +
            "<if test=\"processStatus != null\">" +
            " AND pa.process_status = #{processStatus}" +
            "</if>" +
            "<if test=\"beginTime != null and beginTime != ''\">" +
            " AND pa.begin_time &gt;= #{beginTime}" +
            "</if>" +
            "<if test=\"endTime != null and endTime != ''\">" +
            " AND pa.end_time &lt;= #{endTime}" +
            "</if>" +
            "</script>")
    List<GgPriceAdjust> selectByCondition(SearchDTO dto);
}

